home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 1.toast / Sample Code / Graphics 2D / Palette and GWorld / ReadMe < prev   
Encoding:
Text File  |  2000-10-06  |  2.8 KB  |  41 lines  |  [TEXT/ttxt]

  1. Read Me About...Palette and GWorld
  2. date 08/2000
  3.  
  4. This app copies from two offscreen GWorlds into the left and right halves of the window. The contents of the GWorlds are vertical lines that show all the entries in the color tables associated with the GWorlds. The GWorlds were created as described below. 
  5.  
  6. One commonly asked question is how to use a palette when drawing into a GWorld. The trick is understanding that while setting a palette to a GWorld is permitted, doing so does not change the GWorld’s color table. 
  7.  
  8. The solution is to make a palette from the color table ( or the color table from a palette) and to use that color table to create or update the GWorld. After then doing a SetGWorld you can either draw with Index2Color and RGBForeColor, or you can set the palette to the GWorld and draw with PmForeColor. These techniques are shown in the procedures createRGBForeColorImage and createPmForeColorImage in Palette and GWorld.c.
  9. Building the Code
  10. This project was built and tested on CodeWarrior 2.1 using CarbonLib 1.1a3.  Since this is a Carbon app, the "Carbon Support" folder of the CarbonSDK should be in the same folder as the CodeWarrior IDE.  If this is not the case, the CarbonLib library will have to be re-added to the project.  In addition, the CarbonLib extension needs to be in the extension folder.  The CarbonSDK (which contains the library and the extension) can be found on Apple's website:  http://developer.apple.com/sdk/
  11.  
  12. Restrictions
  13. Nearly every sample requires more memory than the 384KB CodeWarrior sets as the default heap size.  If for some reason the memory has been reset to the default (either through converting the project or whatever) the memory should be reset to 1000 - 2000KB (depending on the application).  This can be achieved by going to the projects settings (Edit Menu->C-PPC Settings... under CodeWarrior 2.1) and selecting the "PPC Target" under the "Target" tab.
  14.  
  15. Other Code Notes
  16. This sample used to be a "non-Carbon" sample, but has been carbonized for demonstration purposes.  The "old" code has been left in (commented out) in order to compare and contrast the Carbon versus non-Carbon APIs.
  17.  
  18. Known Bugs
  19. No known bugs.
  20.  
  21. Possible Future Enhancements
  22. None at present.
  23.  
  24. Other Sources of Reference
  25. Additional sample code can be found at:
  26. http://developer.apple.com/samplecode/
  27. in addition, the Carbon API can be found at:
  28. http://developer.apple.com/techpubs/carbon/carbon.html
  29.  
  30. Version History
  31. See source for version history.
  32.  
  33. Notes: (Old comments)
  34. 1) Palette&GWorld (Fat) was constructed using the method described in chapter 6 of “Power Macintosh Programming Starter Kit.” The output of Palette&GWorld.68K.π is Palette&GWorld.PPC.π.rsrc which is used by Palette&GWorld.PPC.π to create Palette&GWorld (Fat).
  35.  
  36. 2) Thanks to Mr. Ed for the demo shell.
  37.  
  38. Author
  39. JM - Apple Developer Technical Support - dts@apple.com
  40.  
  41.